#include <iostream>
#include <string>
using namespace std;
int main()
{
    string str;
    getline(cin,str);
    size_t pos = str.rfind(" ");
    if (pos == string::npos)
        cout << str.size();
    else
        cout << str.size() - 1 - pos;
}
